import scala.io.StdIn

object CoinCombinations {
  def main(args: Array[String]): Unit = {
    println("请输入一个正整数金额：")
    val amount = StdIn.readInt()

    val coins = List(100, 50, 20, 10, 5, 2, 1)
    var remaining = amount
    var count = 0

    println(s"金额 $amount 的组合：")
    for (coin <- coins) {
      val numCoins = remaining / coin
      if (numCoins > 0) {
        println(s"$numCoins 个 $coin 元")
        remaining -= numCoins * coin
        count += 1
      }
    }
    println(s"总组合数量：$count")
  }
}